﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<dynamic>" %>

<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
	jQuery EasyUI 1.2.2
</asp:Content>

<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
	<script type="text/javascript">
	    $(document).ready(function () {
	        $("#AddRow").click(function () {
	            $("#all").append("<input id=\"dd11\" class=\"easyui-datebox\" required=\"true\"></input>");
	           // $('.date').not('.hasDatePicker').datepicker();
	        });
	    });
	    function disable() {
	        $('#dd').datebox('disable');
	    }
	    function enable() {
	        $('#dd').datebox('enable');
	    }
	</script>

    <h2>jQuery EasyUI 1.2.2</h2>

    	<h1>DateBox</h1>
	<div style="margin-bottom:10px;">
		<a href="#" onclick="disable()">disable</a>
		<a href="#" onclick="enable()">enable</a>
	</div>
    <div id="all">
	<input id="dd" class="easyui-datebox" required="true"></input>
    </div>
    <button id="AddRow" title="AddRow"></button>    

    <h1> Tree </h1>
    <input id="reload" title="reload"  name="reload" value="relaod" type="button"/>
    <input id="delete" title="delete"  name="delete" value="delete" type="button"/>

    <input id="getTreeStatus" title="getTreeStatus"  name="getTreeStatus" value="getTreeStatus" type="button"/>
    <input id="setTreeStatus" title="setTreeStatus"  name="setTreeStatus" value="setTreeStatus" type="button"/>

    <input id="getTreeCheckedByNode" title="getTreeCheckedByNode"  name="getTreeCheckedByNode" value="getTreeCheckedByNode" type="button"/>

    <input id="getTreeChecked" title="getTreeChecked"  name="getTreeChecked" value="getTreeChecked" type="button"/>
    <input id="setTreeChecked" title="setTreeChecked"  name="setTreeChecked" value="setTreeChecked" type="button"/>
    <div>
        <input id = "treeStatus" title="treeStatus" name="treeStatus" type="text" style="width:800px;height:60px;"/>
    </div>
    <div>
        <input id = "treeChecked" title="treeChecked" name="treeChecked" type="text" style="width:800px;height:60px;"/>
    </div>


    	<ul id="tree"></ul>

</asp:Content>

<asp:Content ID="Content3" ContentPlaceHolderID="HeadContent" runat="server">
	<link rel="stylesheet" type="text/css" href="../../jquery-easyui-1.2.2/themes/default/easyui.css"/>
	<link rel="stylesheet" type="text/css" href="../../jquery-easyui-1.2.2/themes/icons/back.png"/>
	<script type="text/javascript" src="../../Scripts/jquery-1.4.4.js"></script>    
    <script src="../../Scripts/jquery.json.js" type="text/javascript"></script>
	<script type="text/javascript" src="../../jquery-easyui-1.2.2/plugins/jquery.tree.js"></script>
    <script type="text/javascript" src="../../jquery-easyui-1.2.2/locale/easyui-lang-zh_CN.js"></script>

    
	<script type="text/javascript">
	    $(function () {

	        $('#tree').tree({
	            checkbox: true,
	            cascadeCheck: false,

	            url: '<%=Url.Content("~/EasyUI/GetTree") %>',
	            onCheck: function (node, checked) {
	                var parent = $('#tree').tree('getParent', node.target);
	                var nodes = $('#tree').tree('getChecked', parent.target, true);
	                if (nodes.length >= 2) {
	                    $('#tree').tree('uncheck', nodes[0].target);
	                }

	            },
	            onClick: function (node) {
	            }
	        });

	        $('#reload').click(function () {
	            var node = $('#tree').tree('getSelected');
	            if (node == null)
	                return;
	            $('#tree').tree('reload', node.target);
	        });

	        $('#delete').click(function () {
	            var node = $('#tree').tree('getSelected');
	            if (node == null)
	                return;
	            $('#tree').tree('remove', node.target);
	        });

	        $('#getTreeStatus').click(function () {
	            var status = $('#tree').tree('getStatus');
	            var json = JSON.stringify(status);
	            $('#treeStatus').val(json);
	        });

	        $('#setTreeStatus').click(function () {
	            var json = $('#treeStatus').val();
	            var status = JSON.parse(json);
	            $('#tree').tree('setStatus', status);
	        });

	        $('#getTreeCheckedByNode').click(function () {	            
	            var checked = $('#tree').tree('getCRNodesByNode');
	            var json = JSON.stringify(checked);
	            $('#treeChecked').val(json);
	        });

	        $('#getTreeChecked').click(function () {
	            var checked = $('#tree').tree('getCRNodes');
	            var json = JSON.stringify(checked);
	            $('#treeChecked').val(json);
	        });

	        $('#setTreeChecked').click(function () {
	            var json = $('#treeChecked').val();
	            var status = JSON.parse(json);
	            $('#tree').tree('setCRNodes', status);
	        });

	    });
	</script>
</asp:Content>
